Rhapsody Developer Release Copyright 1997 by Apple Computer, Inc. All Rights Reserved.
These notes are for the Developer Release of the compiler tools. They contain information about the following topics:
The following new features have been added to the compiler tools since OPENSTEP 4.2 (NeXT).
-arch
ppc
switch.These bugs have appeared since OPENSTEP 4.2.
Reference |
1666993 |
Problem |
The Rhapsody assembler is different from ppcasm. |
Description |
The major difference is that the Rhapsody assembler is not TOC-based and uses two instructions to load a global or static item. The directives and the syntax of labels and directives of the two assemblers are very different. Also, the Rhapsody assembler is stricter in the parameter types and ranges for instructions. For more on this last topic, see "Instruction Parameter Differences," below. |
Workaround |
The difference between the Rhapsody assembler and the TOC-based model, plus the differences in directives and syntax, may necessitate significant rewriting of assembly code for the Developer Release. The strict parameter requirements might require rewriting of assembly code for the Developer Release but the resulting code should work with ppcasm. |
Reference |
1670513 |
Problem |
BSD 4.4 ar format is not compatible with compiler tools |
Description |
The BSD 4.4 ar command, which creates an archive with object file names longer than 16 characters, produces a format that makes the object file invisible to various tools, including the static link editor. This can lead to undefined symbols when a program links against this archive. Other tools like nm and ranlib also don't see the object files with longer names in the archive. |
Workaround |
Use the -T option with ar to tuncate file names or use libtool -static to create archive libraries. |
Register names can't be designated with just a number. You must
refer to them with their register name. This restriction includes
general registers (r
N), floating point registers,
(f
N), condition registers
(cr
N), and segment registers
(sr
N). However, you can refer to special
registers by their register number or their special register names.
The special register names are in lowercase only (for example,
mq
, xer
, lr
, ctr
,
and dsisr
).
For instance, for the ppcasm assember you could code a move from segment register instruction as:
mfsr r24,9 ; ppcasm assembler
But, for the Rhapsody assembler, this same move would be coded as:
mfsr r24,sr9 ; Rhapsody assembler
For instructions that take the value 0 or a register, shown in the processor manual as "(rA|0)", r0 can't be used and 0 must be coded. The Rhapsody assembler generates an error messages in these cases.
Where a numeric value is expected as a parameter, a register name can't be use. For example, the ppcasm assembler allows the following:
lwz r1,r2(r3) ; ppcasm assembler
For Rhapsdoy, this must be coded as:
lwz r1,2(r3) ; Rhapsody assembler
The Rhapsody assembler generates a warning if branch prediction is coded with an unconditional branch.
The Rhapsody assembler checks all fields for range errors and generates error messages if an expression is out of range. The ppcasm assembler simply uses the low N bits of the expression (where N is the field width) if the value is greater than zero. For example the simplified mnemonic:
inslwi rA,rS,n,b
is equivalent to
rlwimi rA,rS,32-b,b,(b+n)-1
The following code:
inslwi r17,r18,19,20 ; equivalent to rlwimi r17,r18,32-20,20,(20+19)-1
assembles to
rlwimi r17,r18,12,20,6 ; where the low 5 bits (20+19)-1 is 6
with ppcasm. This generates an out-of-range error with the Rhapsody assembler.
For fields less than zero, the ppcasm assembler uses the value of zero. For example, the simplified mnemonic:
clrlslwi rA,rS,b,n
is equivalent to
rlwinm rA,rB,n,b-n,31-b
Thus the following code:
clrlslwi r5,r6,7,8 ; equivalent to rlwinm r5,r6,8,7-8,31-7
assembles to:
rlwinm r5,r6,7,0,24 ; where 7-8 gets turned into 0
with ppcasm. This generates an out-of-range error with the Rhapsody assembler.
All integer expressions in the Rhapsody assembler are signed 32-bit values. Parameters that are 16-bit signed or unsigned immediate values must agree in their upper 16 bits or the assembler generates an out-of-range error message.
For example:
addi r1,r2,0xffff ; out of range for a 16-bit signed immediate
generates the message "Parameter error: expression out of range (parameter 3)".
The addi
instruction takes a signed immediate value
so it will sign extend its parameter to 32 bits before preforming the
operation. If the value 0xffffffff is intended, it would be coded as:
addi r1,r2,0xffffffff
If this is half of a two-instruction 32-bit add it should be coded as:
addis r1,0,ha16(expression) addi r1,r2,lo16(expression)
Many of the simplified mnemonics are implemented as Rhapsody assembler macros (as noted in the listing of PowerPC assembler instructions in the assember manual). Like all macros, the macro is expanded and assembled. This expansion can result in errors that can seem confusing when you look at the coded macro. For example, the simplified mnemonic:
extldi rA,rS,n,b
is equivalent to
rldicr rA,rS,b,n-1
Thus the following code:
extldi r1,r2,0,2
generates the error message "Parameter error: expression out of range (parameter 4)," which refers to "n-1" or "0-1", or parameter 4 of the expanded macro.
The instruction tlbiex
, which has been removed from
the PowerPC architecture, is not supported by the Rhapsody assembler.
This instruction is assembled by ppcasm.